import request from "@/axios"

export function listBySaleType(saleTypeId){
    let url = '/api/goods/sale'
    let params = {saleTypeId}
    return request.get(url,{params})
}

export function group(goodsId){
    let url = '/api/goods/group'
    let params = {goodsId}
    return request.post(url,null,{params})
}

//推荐产品
export function listGoods(page,type,order) {
    let limit = 6
    let url = '/api/goods/list'
    let params = {
        limit:limit,
        page:page,
        type,
        order
    }
    return request.get(url,{params})
}

//获取所有的分类
export function listType() {
    let params = {
        type:1
    }
    let url =  '/api/goods/type'
    return request.get(url,{params})
}
//我的问答
export function myQuiz(temp,page,limit) {
    let url = '/api/QA/myQuiz?temp='+temp+"&page="+page+"&limit="+limit
    return request.get(url)
}
//文档下载
export function docDown(id) {
    let url = '/api/goods/docDown?goodsId='+id
    return request.get(url)
}
//查询所有问店铺数据
export function queryGoodsId(id,page,limit) {
    let url = '/api/QA/queryGoodsId?goodsId='+id+'&page='+page+'&limit='+limit
    return request.get(url)
}
//所有回答
export function queryQuestionId(id) {
    let url = '/api/QA/queryQuestionId?queryQuestionId='+id
    return request.get(url)
}
//提问
export function question(goodsId,content) {
    let url = '/api/QA/question'
    /*    request.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'*/
    let data = {goodsId,content}
    return request.post(url,data)
}
// 回答
export function answer(questionId,content) {
    let url = '/api/QA/answer'
    let data = {questionId,content}
    return request.post(url,data)
}
